/* jshint -W024 */
import Vue from 'vue'
import Router from 'vue-router'
import store from '@/store/index.js'


//公共模块路由
const SharingRouter = [
{
    // 首页
    path: '/',
    name: '/',
    component: () =>
        import('@/components/HelloWorld.vue'),
	children:[
		{path:'/',
		component:()=>import('../components/Main.vue')
		},
		{path:'/DealCenter',
		component:()=>import('../components/DealCenter.vue'),
		children:[
			{
			path:'/DealCenter',
			component:()=>import('../components/Router-Deal/DealOrder'),
			children:[
				{
					path:'/DealCenter',
					component:()=>import('../components/Router-Deal/QueryByOrder'),

				},
				{
					path:'/QueryByNum',
					component:()=>import('../components/Router-Deal/QueryByNum'),

				}
			]
			},
			{
				path:'/Refound',
				component:()=>import('../components/Router-Deal/Refound'),
        children:[
          {
          	path:'/Refound',
          	component:()=>import('../components/Router-Deal/QueryRefound'),
            children:[
              {path:'/Refound',
              component:()=>import('../components/Router-Deal/QueryFoundForm1'),
              },
              {path:'/QueryFoundForm2',
              component:()=>import('../components/Router-Deal/QueryFoundForm2'),
              },
            ]

          },
          {
          	path:'/ToRefound',
          	component:()=>import('../components/Router-Deal/ToRefound'),

          },
        ]
			}
		],
		},
		{path:'/CounterCenter',
		component:()=>import('../components/CounterCenter.vue')
		},


	]
},
];

Vue.use(Router);


const router = new Router({
    // mode: 'history',
    routes: [...SharingRouter,],

})

// router.beforeEach((to, from, next) => {
    // console.log('to',to)
    // let userInfo = JSON.parse(sessionStorage.getItem('UserInfo'));
    // if (!userInfo && to.path !== '/Login' && to.path !== '/Regist') { // 用户id 不存在的时候跳转到登录
    //     next('/Login');
    //     return;
    // }
    // if (sessionStorage.getItem('AccessToken')) { // 通过vuex state获取当前的token是否存在
    //     if(to.path=='/examList'||to.path=='/user/examCase'){
    //         // console.log("***********",userInfo)
    //         if(userInfo.type==6){
    //             next();
    //             return;
    //         }else{
    //             next('/new_index');
    //             return;
    //         }
    //     }else{
    //         next();
    //         return;
    //     }
    // } else {

    // }
    // next();
// })

export default router;
